nlp_architect.data.cdc_resources.relations.within_doc_coref_extraction.WithinDocCoref

class nlp_architect.data.cdc_resources.relations.within_doc_coref_extraction.WithinDocCoref(wd_file: str)[source]
__init__(wd_file: str)[source]

Extract Relation between two mentions according to Within document co-reference

Parameters

wd_file (required) – str Location of within doc co-reference mentions file

Methods

__init__(wd_file)

Extract Relation between two mentions according to Within document co-reference

arrange_resource(wd_mentions_json)

create_ment_id(mention_x, mention_y)

extract_all_relations(mention_x, mention_y)

extract_relation(mention_x, mention_y, relation)

Base Class Check if Sub class support given relation before executing the sub class

extract_sub_relations(mention_x, mention_y, …)

Check if input mentions has the given relation between them

extract_within_coref(mention)

get_supported_relations()

Return all supported relations by this class

get_within_doc_coref_chain()

static arrange_resource(wd_mentions_json)[source]
static create_ment_id(mention_x: nlp_architect.common.cdc.mention_data.MentionData, mention_y: nlp_architect.common.cdc.mention_data.MentionData) → str[source]
extract_all_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionData, mention_y: nlp_architect.common.cdc.mention_data.MentionData) → Set[nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType][source]
extract_relation(mention_x: nlp_architect.common.cdc.mention_data.MentionDataLight, mention_y: nlp_architect.common.cdc.mention_data.MentionDataLight, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType

Base Class Check if Sub class support given relation before executing the sub class

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation and

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

extract_sub_relations(mention_x: nlp_architect.common.cdc.mention_data.MentionData, mention_y: nlp_architect.common.cdc.mention_data.MentionData, relation: nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType) → nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType[source]

Check if input mentions has the given relation between them

Parameters
  • mention_x – MentionDataLight

  • mention_y – MentionDataLight

  • relation – RelationType

Returns

relation in case mentions has given relation or

RelationType.NO_RELATION_FOUND otherwise

Return type

RelationType

extract_within_coref(mention: nlp_architect.common.cdc.mention_data.MentionData) → List[str][source]
static get_supported_relations() → List[nlp_architect.data.cdc_resources.relations.relation_types_enums.RelationType][source]

Return all supported relations by this class

Returns

List[RelationType]

get_within_doc_coref_chain()[source]